package com.fxu.mq.consumer;

import com.fxu.framework.mq.redis.streams.RedisStreamListener;
import com.fxu.mq.message.RedisSimpleMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ObjectRecord;
import org.springframework.stereotype.Component;

import static com.fxu.mq.api.RedisMqTestController.STREAMS_KEY;

/**
 * 针对 {@link RedisSimpleMessage} 的消费者
 * @author fangxu
 */
@Slf4j
@Component
public class RedisStreamsConsumer extends RedisStreamListener<String, MapRecord<String, Object, Object>> {

    @Override
    public boolean doMessage(Object message) {
        log.info("[RedisStreamsConsumer][消息内容({})]", message);
        return true;
    }

    @Override
    public String getStreamKey() {
        return STREAMS_KEY;
    }

    @Override
    public String getGroupName() {
        return "group1";
    }

    @Override
    public String getConsumerName() {
        return "name1";
    }

}
